<!--
 * @Description: 无
 * @Author: Sue
 * @Date: 2020-04-14 23:42:20
 * @LastEditors: Sue
 * @LastEditTime: 2020-07-29 15:54:55
-->
<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>XIUMI connect</title>
  <style>
    html,
    body {
      padding: 0;
      margin: 0;
    }

    #xiumi {
      position: absolute;
      width: 100%;
      height: 100%;
      border: none;
      box-sizing: border-box;
    }

  </style>
</head>

<body>
  <iframe id="xiumi" src="//xiumi.us/studio/v5#/paper">
  </iframe>
  <script type="text/javascript" src="./internal.js"></script>
  <script>
    var xiumi = document.getElementById('xiumi');
    var xiumi_url = window.location.protocol + "//xiumi.us";


    window.onload = function () {
      setTimeout(function () {
        xiumi.contentWindow.postMessage(editor.getContent(), '*');
      }, 3000);
    };

    xiumi.onload = function () {
      console.log('postmessage');
      xiumi.contentWindow.postMessage('ready', xiumi_url);
    };
    document.addEventListener("mousewheel", function (event) {
      event.preventDefault();
      event.stopPropagation();
    });
    window.addEventListener('message', function (event) {
      if (event.origin == xiumi_url) {
        editor.execCommand('insertHtml', event.data);
        dialog.close();
      }
    }, false);

  </script>
</body>

</html>
